Skip to content

examples: Update winit requirement to 0.30#1008

Open
fryeb wants to merge 3 commits intoash-rs:masterfrom
fryeb:winit-0.30
Open

examples: Update winit requirement to 0.30#1008
fryeb wants to merge 3 commits intoash-rs:masterfrom
fryeb:winit-0.30

Conversation

@fryeb
Copy link

@fryeb fryeb commented Oct 10, 2025

Supersedes #914 (since 0.30 has breaking changes it requires some code changes).

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Ralith
Copy link
Collaborator

Ralith commented Oct 11, 2025

I'd merge this, but both it and master fail on my (NixOS) machine with:

thread 'main' panicked at /home/ralith/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/x11-dl-2.19.1/src/xlib.rs:25:1:
null pointer dereference occurred

so I'd better wait for someone else to test.

fn resumed(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
let window_attributes =
WindowAttributes::default().with_inner_size(PhysicalSize::<u32>::from((800, 600)));
let window = event_loop.create_window(window_attributes).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Window creation does not belong inside surface "creation", if that is suggested by an upstream example that's an error.

If I remember correctly we cleared up all the callbacks and terminology upstream in the impending winit 0.31 release.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the window in the resume method because that is what the main example in the winit docs does (and then of course surface creation depends on window creation).

If that's incorrect behavior though maybe both examples need to be updated?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like in the next release of winit this is split into a can_create_surface method: https://rust-windowing.github.io/winit/winit/changelog/index.html#changed

But since this isn't available in 0.30, resumed is the correct method to create the window & surface in. (Maybe we add a reminder comment though? Just to make it clear?)

@MarijnS95 MarijnS95 changed the title Update winit to 0.30 (in examples) examples: Update winit requirement to 0.30 Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants